package com.weiai.wedding.util;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.WebApplicationContextUtils;

@Component
public class ContextLoaderListener  extends org.springframework.web.context.ContextLoaderListener  {
	 public void contextInitialized(ServletContextEvent event) { 
	    ServletContext context = event.getServletContext(); 
	        super.contextInitialized(event); 
	        ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); 
	        SpringContextUtil.setApplicationContext(ctx); 
	 } 
}
